import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUi from 'element-ui'
import moment from 'moment'
import axios from 'axios'
import './assets/css/global.css'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/fonts/iconfont.css'
import ZkTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

Vue.use(VueQuillEditor /* { default global options } */)

axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  config.headers.Authorization = sessionStorage.getItem('token')
  return config
})
Vue.prototype.$http = axios
Vue.use(ElementUi)
Vue.component('tree-table', ZkTable)

Vue.filter('dateFormat', function (val, format) {
  // 当时间数字单位为毫秒,数字长度为13位时
  // return moment(val).format(format)
  // 当时间数字单位为秒,数字长度为10位时 下面两种方法都可以
  // return moment(val * 1000).format(format)
  return moment.unix(val).format(format)
})

Vue.config.productionTip = false
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
